package com.ghd.dataviz.controller;

import com.ghd.dataviz.core.constant.RedisKey;
import com.ghd.dataviz.core.param.DatavizResponse;
import com.ghd.dataviz.core.param.UserDisplayPageInfo;
import com.ghd.dataviz.utils.RedisUtil;
import com.ghd.dataviz.utils.UserUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：ghd
 * @date ：Created in 2020-03-22 20:55
 * @description：大屏展示相关接口
 * @modified By：
 * @version: $
 */
@Slf4j
@RestController
@Api(tags = "大屏展示相关接口")
@RequestMapping("display")
public class DisplayController {

    private final RedisUtil redisUtil;

    public DisplayController(RedisUtil redisUtil) {
        this.redisUtil = redisUtil;
    }


    @PostMapping("get-display-page-info")
    @ApiOperation("获取当前用户展示页面信息")
    public DatavizResponse<UserDisplayPageInfo> getDisplayPageInfo() {
        UserDisplayPageInfo info =
                (UserDisplayPageInfo) redisUtil.hget(RedisKey.USER_DISPLAY_INFO, UserUtil.getUserName());
        return DatavizResponse.success("获取当前用户展示页面信息成功", info);
    }


}
